<?php
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller {
    public function _initialize(){
      $this->model=D('user');

    }

    public function login(){
       $this->display();
    }
    public function dologin(){
       //adminname
    	//password
      $map=array( 
        'zhr_adminname'=> I('post.adminname'),
        'zhr_password' => md5(I('post.password'))
      );
      $admin=M('admin')->where($map)->find();
      if($admin){
      	//session('admin',$admin['adminname']);
         session('admin',$admin);
         $this->redirect('admin.php/user/index');
      }else{
         $this->redirect('admin.php/login/login');
      }
    }
    public function logout(){
       session('admin',null);
       $this->redirect('admin.php/login/login');
    }
}
